Text Dictionary

Description

The 'Text Dictionary' tag is a language tag that can be used to lookup up the tag definition in a SQL table - the 'Text Dictionary Table'. This makes it easy to internationalize your application.

Discussion

Text Dictionary tags are a powerful way to dynamically load text content in your application, allowing you to build apps that can be translated into multiple languages. The content shown in the application is retrieved at run-time by querying the SQL Text Dictionary database.

To start using text dictionary tags in your components, you must first configure your Text Dictionary (i.e. tell your application what connection string and table to use for the Text Dictionary). To configure the Text Dictionary, click on the Project Properties button when the Web Control Panel has focus.

In the dialog you will see a section labeled 'Text Dictionary'. Specify the name of the connection string and the table. If you don't currently have a table, you can click the hyperlink to have Alpha Anywhere create the table for you.

If you have an existing table that you would like to use you can map the fields in your table to the required fields in the Text Dictionary.

The Text Dictionary Table has these fields

  • key

  • language

  • data

'key' is the value of the tag. So, or example, if your component contains this text, the 'key' is 'string1':

<a5:t>string1</a5:t>

For each 'key', you can define data for multiple languages. The 'language' field contains the language name.

The 'data' field contains the text to use for a particular 'key' when a particular 'language' is active.

If you have not defined a record for a particular language, the default value will be used.

Once you have defined and populated the Text Dictionary, you can start using text dictionary tags in your component.

The component builders have a Text Dictionary Tags property with a corresponding smart field:

images/textdictionary1.gif

When you click the smart field, this dialog is opened. It shows:

  • the language tags used in the component

  • what languages have been defined in the Text Dictionary for this tag

  • whether a text dictionary tag that was used in the component has been defined in the Text Dictionary

For example, in the image below, we see that for 'string1', definitions exist for the default language, Greek, and Japanese. We also see that in the component, we defined as string that used a Text Dictionary tag with a key of 'xxxx', but that this item has not yet been added to the Text Dictionary (indicated by the red icon).

images/textdictionary2.jpg

See Also